#!/usr/bin/env python
# -*- coding: utf-8 -*-

import threading
from web_server.device_proxy import DeviceProxy
from common.utils import LogUtil

logger = LogUtil.get_logger(__name__)

class PerfService:
    def __init__(self, stop_cb: callable, device_proxy: DeviceProxy) -> None:
        self.__stop_cb = stop_cb
        self.__device_proxy = device_proxy
        self.__stop_flag = threading.Event()

    def __del__(self):
        self.destroy()

    def destroy(self):
        if not self.__stop_flag.is_set():
            self.__stop_flag.set()
            if self.__stop_cb:
                self.__stop_cb('perf')

    def start(self):
        return True